﻿Imports _1065144_1065164.DataProvider
Imports System.Data.SqlClient
Public Class LoaiNhaDAO
    Public Shared Function GetAll() As List(Of LoaiNhaDTO)
        Dim listLoaiNha As New List(Of LoaiNhaDTO)
        Dim cn As SqlConnection = New SqlConnection(_strConnectionString)
        Dim cmd As New SqlCommand()
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "ChonLoaiNhaALL"
        cmd.Connection = cn
        cn.Open()

        Dim rd As SqlDataReader = cmd.ExecuteReader()
        While rd.Read()
            Dim loainha As LoaiNhaDTO = New LoaiNhaDTO()
            loainha.iMaLoaiNha = rd.GetInt32(0)
            loainha.strTenLoaiNha = rd.GetString(1)
            listLoaiNha.Add(loainha)
        End While
        cn.Close()

        Return listLoaiNha
    End Function
End Class
